/**
 * AlexDocumentPreprocessingDriver.java created by zhangzhidong 
 * at 上午10:22:30 2016年5月23日
 */
package cn.edu.bjtu.alex;

import java.util.Properties;

import org.shirdrn.document.preprocessing.api.Context;
import org.shirdrn.document.preprocessing.api.ProcessorType;
import org.shirdrn.document.preprocessing.core.component.DocumentTFIDFComputation;
import org.shirdrn.document.preprocessing.core.component.train.FeaturedTermVectorSelector;
import org.shirdrn.document.preprocessing.driver.common.AbstractDocumentProcessorDriver;
import org.springframework.web.socket.WebSocketSession;
import org.shirdrn.document.preprocessing.core.utils.PreprocessingUtils;

/**
 * 
 * @author zhangzhidong<br>
 * comment generated at 2016年5月24日下午10:08:35<br>
 *
 */
public class AlexDocumentPreprocessingDriver extends AbstractDocumentProcessorDriver {
	private static final String CONFIG = "config-alex.properties";
	/**
	 * @Param
	 * @Author zhangzhidong
	 */
	@Override
	public void preprocess(String uid,WebSocketSession session,Properties p) {
		Context context = super.newContext(ProcessorType.TRAIN, CONFIG);
		context.setVectorMetadata(PreprocessingUtils.newVectorMetadata());
		Class<?>[] classes = new Class[] {
				AlexBasicInformationCollector.class,
				AlexDocumentWordsCollector.class,
				//用来计算每个词的chi值
				FeaturedTermVectorSelector.class,
				//用来计算每个文档的tf-idf
				DocumentTFIDFComputation.class
				//OutputtingQuantizedTrainData.class,
				//用来输出arff文件
//				AlexOutputingWekaArffFile.class
		};
		run(PreprocessingUtils.newChainedComponents(context, classes));		
	}
	public static void main(String[] args) {
		AbstractDocumentProcessorDriver.start(
				AlexDocumentPreprocessingDriver.class,null,null,null);		
	}
	


	
}
